﻿@page "/context-menu"
@inject IStringLocalizer<ContextMenus> Localizer
@inject IStringLocalizer<Foo> LocalizerFoo

<h3>@Localizer["ContextMenuTitle"]</h3>

<h4>@Localizer["ContextMenuDescription"]</h4>

<DemoBlock Title="@Localizer["ContextMenuNormalTitle"]" Introduction="@Localizer["ContextMenuNormalIntro"]" Name="Normal">
    <ContextMenuZone>
        <ContextMenuTrigger ContextItem="Foo">
            <span>@Foo.Name - @Foo.Address</span>
        </ContextMenuTrigger>
        <ContextMenu>
            <ContextMenuItem Icon="fa-solid fa-copy" Text="拷贝" OnClick="OnCopy"></ContextMenuItem>
            <ContextMenuItem Icon="fa-solid fa-paste" Text="粘贴" OnClick="OnPaste"></ContextMenuItem>
        </ContextMenu>
    </ContextMenuZone>
</DemoBlock>

<DemoBlock Title="@Localizer["ContextMenuCustomUITitle"]" Introduction="@Localizer["ContextMenuCustomUIIntro"]" Name="CustomUI">
    <ContextMenuZone>
        <ContextMenuList></ContextMenuList>
        <ContextMenu>
            <ContextMenuItem Icon="fa-solid fa-copy" Text="拷贝" OnClick="OnCopy"></ContextMenuItem>
            <ContextMenuItem Icon="fa-solid fa-paste" Text="粘贴" OnClick="OnPaste"></ContextMenuItem>
        </ContextMenu>
    </ContextMenuZone>
</DemoBlock>

<DemoBlock Title="@Localizer["ContextMenuTableTitle"]" Introduction="@Localizer["ContextMenuTableIntro"]" Name="Table">
    <ContextMenuZone>
        <Table TItem="Foo" Items="@Items.Take(3)">
            <TableColumns>
                <TableColumn @bind-Field="@context.DateTime" Width="180" />
                <TableColumn @bind-Field="@context.Name" />
                <TableColumn @bind-Field="@context.Address" />
            </TableColumns>
        </Table>
        <ContextMenu>
            <ContextMenuItem Text="拷贝" OnClick="OnCopy"></ContextMenuItem>
            <ContextMenuItem Icon="fa-solid fa-paste" Text="粘贴" OnClick="OnPaste"></ContextMenuItem>
        </ContextMenu>
    </ContextMenuZone>
</DemoBlock>

<DemoBlock Title="@Localizer["ContextMenuTreeTitle"]" Introduction="@Localizer["ContextMenuTreeIntro"]" Name="Tree">
    <ContextMenuZone>
        <TreeView TItem="TreeFoo" Items="@TreeItems" />
        <ContextMenu>
            <ContextMenuItem Text="拷贝" OnClick="OnCopy"></ContextMenuItem>
            <ContextMenuItem Icon="fa-solid fa-paste" Text="粘贴" OnClick="OnPaste"></ContextMenuItem>
        </ContextMenu>
    </ContextMenuZone>
</DemoBlock>
